<template>
  <div>
    <el-container style="height: 800px; border: 1px solid #eee">
      <!--侧边栏-->
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu :default-openeds="['1']">
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-message"></i>管理</template>
            <el-menu-item-group>
              <!--
                            <template slot="title">分组一</template>
              -->
              <el-menu-item index="1-1">
                <router-link :to="{name:'test1',params:{id:1,userName:this.$route.params.userName,userId:this.$route.params.userId}}">test1</router-link>
              </el-menu-item>
              <el-menu-item index="1-2">
                <router-link :to="{name:'test2',params:{id:2,userName:this.$route.params.userName,userId:this.$route.params.userId}}">test2</router-link>
              </el-menu-item>
              <el-menu-item index="1-3">
                <router-link :to="{name:'test3',params:{id:3,userName:this.$route.params.userName,userId:this.$route.params.userId}}">test3</router-link>
              </el-menu-item>
              <el-menu-item index="1-4">
                <router-link :to="{name:'index',params:{id:3,userName:this.$route.params.userName,userId:this.$route.params.userId}}">回到首页</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-menu"></i>商品管理</template>
            <el-menu-item-group>
              <el-menu-item index="2-1">商品分类</el-menu-item>
              <el-menu-item index="2-2">商品列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title"><i class="el-icon-setting"></i>导航三</template>
            <el-menu-item-group>
              <el-menu-item index="3-1">选项1</el-menu-item>
              <el-menu-item index="3-2">选项2</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>


      <el-container>
        <el-header style="text-align: right; font-size: 12px">
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px">{{this.$route.params.userName}}</i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item  @click.native="updateInfomation()">个人信息</el-dropdown-item>
              <el-dropdown-item  @click.native="outLogin()">退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-header>
        <el-main>
          <div v-show="$route.meta.showFooter">
            主页不知道画什么好
          </div>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "index.vue",
  data() {
  },
  methods:{
    updateInfomation(){
      this.$router.push({name:'updateInfo',params:{userName:this.$route.params.userName,userId:this.$route.params.userId}});
    },
    outLogin(){
      this.$router.push({name:'Login'});
    }
  }
}
</script>

<style scoped>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    color: #333;
  }
</style>
